package com.xuqi.Game.Tetris;

import java.util.ArrayList;

import android.R.integer;
import android.graphics.Canvas;

import com.xuqi.Game.GameDrawElemIF;
import com.xuqi.Game.GameElemShape;
import com.xuqi.Game.GameElemState;
import com.xuqi.Game.GameElement;

public class GameAni extends GameElemState
{
	private int m_i = 0;
	private int m_count = 0;
	public GameAni()
	{
		ArrayList<GameDrawElemIF> stateList = new ArrayList<GameDrawElemIF>();
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk00)).SetLocation(0, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk01)).SetLocation(0, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk02)).SetLocation(20, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk03)).SetLocation(20, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk04)).SetLocation(40, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk05)).SetLocation(40, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk06)).SetLocation(40, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk07)).SetLocation(40, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk08)).SetLocation(40, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk09)).SetLocation(60, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk10)).SetLocation(60, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk11)).SetLocation(60, 0).SetSize(100,100));
		stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk12)).SetLocation(60, 0).SetSize(100,100));
		SetStateArray(stateList);
	}

	@Override
	public void GDraw(Canvas _canvas)
	{
		// TODO Auto-generated method stub
		super.GDraw(_canvas);
		addState();
	}

	public void addState()
	{
		SetCurrentState(m_i++);

		if(m_i > m_StateArrayList.size())
		{
			m_count++;
			ArrayList<GameDrawElemIF> stateList = new ArrayList<GameDrawElemIF>();
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk00)).SetLocation(m_count* 60 + 20, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk01)).SetLocation(m_count* 60 + 20, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk02)).SetLocation(m_count* 60 + 40, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk03)).SetLocation(m_count* 60 +40, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk04)).SetLocation(m_count* 60 +60, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk05)).SetLocation(m_count* 60 +60, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk06)).SetLocation(m_count* 60 +60, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk07)).SetLocation(m_count* 60 +60, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk08)).SetLocation(m_count* 60 +60, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk09)).SetLocation(m_count* 60 +80, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk10)).SetLocation(m_count* 60 +80, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk11)).SetLocation(m_count* 60 +80, 0).SetSize(100,100));
			stateList.add((new GameElement().SetImage(com.xuqi.R.drawable.walk12)).SetLocation(m_count* 60 +80, 0).SetSize(100,100));
			SetStateArray(stateList);
		}
		if(m_i >= m_StateArrayList.size())
		{
			m_i = 0;

		}

	}
}
